home *** CD-ROM | disk | FTP | other *** search
- ; RI Zoomer
- ; (C)1994 Reflective Images
- ; By Stephen NcNamara
- ; Uses: FX-library
- ; FNS-library
- ; Make sure you have these installed before you try compiling this program.
- ; Demonstrates: Using ZoomXn commands, FNS printing commands.
-
- DEFTYPE.w windh,windw,windwmod,azoom,bzoom,azoom2,azoom3,bzoom3
-
- Statement WBackFill{winnum.b,gadsize.w}
- ad.l=RastPort(winnum)
- Poke.l ad+8,?mypattern
- Poke.b ad+$1d,1
-
- Use Window winnum
- x1.w=WLeftOff
- y1.w=WTopOff
- x2.w=x1+InnerWidth-4
- y2.w=y1+InnerHeight-gadsize
- WBox x1,y1,x2+4,y1+1,2 ; Top 2 pixels
-
- WBox x1,y1,x1+3,y2,2 ; Left 4 pixels
-
- WBox x2+1,y1,x2+4,y2,2 ; Right 4 pixels
-
- WBox x1,y2+1,x2+4,y2+gadsize,2 ; Bottom area
-
- Poke.l ad+8,0
- Poke.b ad+$1d,0
-
- Wline x1+4,y2,x1+4,y1+2,x2,y1+2,1
- Wline x2,y1+2,x2,y2,x1+4,y2,2
-
- Statement Return
-
- mypattern: Dc.w $aaaa
- Dc.w $5555
- End Statement
-
- NoCli
- AMIGA
-
- WBStartup
- WbToScreen 0 ; get Workbench as screen 0
- ShowScreen 0 ; bring it to the front
- ScreensBitMap 0,0 ; get the bitmap
- Use BitMap 0 : BitMapOutput 0
-
- deep.b=Peek.b(Addr BitMap(0)+5) ; get Workbench depth
- If deep<1 Then BeepScreen 0 : End ; if error then end
-
- BitMap 1,320,256,deep ; get a couple of bitmaps
- BitMap 2,640,512,deep
-
- BorderPens 2,1
-
- Use Screen 0
- ad.l=Peek.l(Addr Screen(0))
- scrw.l=Peek.w(ad+12) ; Workbench width
- scrh=Peek.w(ad+14) ; Workbench height
-
- MenuTitle 0,0,"Zoomer"
- MenuItem 0,1,0,0," Zoom X2 display ","1"
- MenuItem 0,1,0,1," Zoom X4 display ","2"
- MenuItem 0,1,0,2," Zoom X8 display ","3"
- MenuItem 0,0,0,3,"========================" : MenuState 0,0,3,Off
- MenuItem 0,0,0,4,"Program info ","H"
- MenuItem 0,0,0,5,"Quit and die ","Q"
- MenuTitle 0,1,"Preferences"
- MenuItem 0,%1,1,0," Coordinates ","C"
- MenuItem 0,%1,1,1," Crosshairs ","X"
-
- SizeLimits 64,64,640,512
- Window 0,487,22,153,64,$1|$2|$4|$8|$10|$20|$40|$200|$400|$1000|$200000,"RI Zoom window (X2)",1,2,0
- SetMenu 0
-
- zoom.w=2 : zoommenu=0
- Gosub UpdateWind
- Repeat
- ev.l=Event : evw.l=EventWindow
- If evm=0
- If ev=4 OR ev=2
- Use BitMap 2 : BitMapOutput 2
- Cls
- Use Window 0 : WCls
- Use BitMap 0 : BitMapOutput 0
- Gosub UpdateWind
- EndIf
- If ev=64 AND GadgetHit=0 AND info
- Gosub RemoveInfo
- EndIf
- If ev=256 AND MenuHit=0
- oldzoom.w=zoom
- oldzoommenu=zoommenu
- Select ItemHit
- Case 0
- zoom=2 : zoommenu=0
- Case 1
- zoom=4 : zoommenu=1
- Case 2
- zoom=8 : zoommenu=2
- Case 4
- Gosub About
- Case 5
- End
- End Select
- If zoom=oldzoom
- ; If MenuChecked(0,0,zoommenu)=0 Then MenuList 0,0,zoommenu
- ; Else
- ; If MenuChecked(0,0,oldzoommenu) Then MenuList 0,0,oldzoommenu
- ; If MenuChecked(0,0,zoommenu)=0 Then MenuList 0,0,zoommenu
- EndIf
- If oldzoom<>zoom
- Use BitMap 2 : BitMapOutput 2
- Cls
- Use Window 0 : WCls
- Gosub UpdateTitle
- Gosub UpdateWind
- EndIf
- EndIf
- If ev=256 AND MenuHit=1
- Select ItemHit
- Case 0
- coords=MenuChecked(0,1,0)
- If coords=0 Then Gosub UpdateTitle
- Case 1
- crosshairs.b=MenuChecked(0,1,1)
- End Select
- EndIf
- EndIf
-
- Use BitMap 1 : BitMapOutput 1
- xm.w=SMouseX : ym.w=SMouseY
- x.w=xm-azoom3 : y.w=ym-bzoom3
- If x<0 Then x=0
- If y<0 Then y=0
- If x>scrw-azoom Then x=scrw-azoom
- If y>scrh-bzoom Then y=scrh-bzoom
- Scroll x,y,azoom,bzoom,0,0,0
- If crosshairs
- Line xm-x,0,xm-x,bzoom-1,-1
- Line 0,ym-y,azoom-1,ym-y,-1
- EndIf
- azoom2.w=Smallest(azoom+8,320)
- Select zoom
- Case 2
- ZoomX2 1,2,0,0,azoom2,bzoom
- Case 4
- ZoomX4 1,2,0,0,azoom2,bzoom
- Case 8
- ZoomX8 1,2,0,0,azoom2,bzoom
- End Select
- Use Window 0
- If coords Then WTitle Str$(xm)+","+Str$(ym)
- BitMaptoWindow 2,0,0,0,0,0,windwmod,windh
- VWait
- Until ev=$200 AND evm=0
- End
-
- About:
- If info=1 Then Return
- FNSOutput 1,1 ; set output to bitmap 1 and update CLIP
- FNSPrefs %1,1 ; centred text in colour 1
- Use BitMap 1 : BitMapOutput 1 : Cls
- FNSPrint 0,70,2,"Okay" ; print in default font at 70,2
- Line 0,0,139,0,2 : Line 139,11,1 : Line 0,11,1 : Line 0,0,2
- GetaShape 0,0,0,140,12
-
- Boxf 1,1,138,10,3
- Line 0,0,139,0,1 : Line 139,11,2 : Line 0,11,2 : Line 0,0,1
- FNSPrint 0,70,2,"Okay" ; print in default font at 70,2
- GetaShape 1,0,0,140,12
-
- Cls
- Use BitMap 0 : BitMapOutput 0
- Restore AboutInfo
- Read num.w
- Read a$
- FNSPrint 0,160,2,a$,%111,1 : y.w=12 ; print title with underline & bold
- For h=1 To num-1
- Read a$
- FNSPrint 0,160,y,a$
- y+10
- Next h
- x.w=(ScreenWidth-320)/2 : y.w=(ScreenHeight-120)/2
- ShapeGadget 0,160-70,118-6,0,0,0,1
- Window 1,x,y,320,128,$11006,"Program Info",1,2,0
- WBackFill{1,18}
- x=160-70 : y=118-6
- WBox x,y,x+139,y+11,0
- WBlit 0,x,y
- BitMaptoWindow 1,1,16,0,16,14,272,90
- If coords=0 Then Gosub UpdateTitle
- info=1
- Return
-
- RemoveInfo:
- Free Window 1
- Use Window 0
- Activate 0
- ev=0
- Free GadgetList 0
- info=0
- Return
-
- UpdateTitle:
- If coords=0 Then Use Window 0 : WTitle "RI Zoom Window (X"+Str$(zoom)+")"
- Return
-
- UpdateWind:
- Use Window 0
- windw.w=InnerWidth
- windh.w=InnerHeight
- windwmod.w=windw-(windw MOD zoom)
- azoom.w=(windw)/zoom
- bzoom.w=(windh)/zoom
- azoom3=azoom ASR 1
- bzoom3=bzoom ASR 1
- Return
-
- AboutInfo:
- Data.w 9
- Data$ "RI Zoomer v0.2","(C) 1994 Leading Edge Software",""
- Data$ "Written in Blitz Basic 2 by","Stephen McNamara"
- Data$ "EMAIL: SIS3149@SIS.PORT.AC.UK",""
- Data$ "Using the Blitz 2 libraries developed by","L.E.S./R.I."
-
-